
# -*- coding: utf-8 -*-

import os
from peewee import *
from config.Config import IMAGE_DIR, RAW_IMAGE_DIR
from models.Base import BaseModel

class User(BaseModel):

	name = CharField()
	username = CharField()

	def persist(self):
		path = os.path.join(IMAGE_DIR, unicode(self.username))
		rawpath = os.path.join(RAW_IMAGE_DIR, unicode(self.username))

		if not os.path.exists(path):
			os.makedirs(path)

		if not os.path.exists(rawpath):
			os.makedirs(rawpath)

		self.save()